package com.lzy.mall.product;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.UUID;

/**
 * @author lzy
 * @date 2021/9/9 13:45
 */
@SpringBootTest
@RunWith(SpringRunner.class)
public class test {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @Autowired
    private RedissonClient redissonClient;

    @Test
    public void redisson(){
        System.out.println("123");
        System.out.println(redissonClient);
    }

    @Test
    public void redisTest(){
        //k:hello,v:world
        ValueOperations<String, String> ops = stringRedisTemplate.opsForValue();
        ops.set("hello","world_" + UUID.randomUUID().toString());

        String hello = ops.get("hello");
        System.out.println(hello);
    }
}
